home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / demo / server / init.cs < prev   
Text File  |  2006-09-08  |  3KB  |  81 lines

  1. //-----------------------------------------------------------------------------
  2. // Torque Game Engine 
  3. // Copyright (C) GarageGames.com, Inc.
  4. //-----------------------------------------------------------------------------
  5.  
  6. //-----------------------------------------------------------------------------
  7.  
  8. // Variables used by server scripts & code.  The ones marked with (c)
  9. // are accessed from code.  Variables preceeded by Pref:: are server
  10. // preferences and stored automatically in the ServerPrefs.cs file
  11. // in between server sessions.
  12. //
  13. //    (c) Server::ServerType              {SinglePlayer, MultiPlayer}
  14. //    (c) Server::GameType                Unique game name
  15. //    (c) Server::Dedicated               Bool
  16. //    ( ) Server::MissionFile             Mission .mis file name
  17. //    (c) Server::MissionName             DisplayName from .mis file
  18. //    (c) Server::MissionType             Not used
  19. //    (c) Server::PlayerCount             Current player count
  20. //    (c) Server::GuidList                Player GUID (record list?)
  21. //    (c) Server::Status                  Current server status
  22. //
  23. //    (c) Pref::Server::Name              Server Name
  24. //    (c) Pref::Server::Password          Password for client connections
  25. //    ( ) Pref::Server::AdminPassword     Password for client admins
  26. //    (c) Pref::Server::Info              Server description
  27. //    (c) Pref::Server::MaxPlayers        Max allowed players
  28. //    (c) Pref::Server::RegionMask        Registers this mask with master server
  29. //    ( ) Pref::Server::BanTime           Duration of a player ban
  30. //    ( ) Pref::Server::KickBanTime       Duration of a player kick & ban
  31. //    ( ) Pref::Server::MaxChatLen        Max chat message len
  32. //    ( ) Pref::Server::FloodProtectionEnabled Bool
  33.  
  34. //-----------------------------------------------------------------------------
  35.  
  36.  
  37. //-----------------------------------------------------------------------------
  38.  
  39. function initServer()
  40. {
  41.    echo("\n--------- Initializing MOD: Torque Demo Server ---------");
  42.  
  43.    // Server::Status is returned in the Game Info Query and represents the
  44.    // current status of the server. This string sould be very short.
  45.    $Server::Status = "Unknown";
  46.  
  47.    // Turn on testing/debug script functions
  48.    $Server::TestCheats = true;
  49.  
  50.    // Specify where the mission files are.
  51.    $Server::MissionFileSpec = "*/missions/*.mis";
  52.  
  53.    // The common module provides the basic server functionality
  54.    initBaseServer();
  55.  
  56.    // Load up game server support scripts
  57.    exec("./scripts/commands.cs");
  58.    exec("./scripts/centerPrint.cs");
  59.    exec("./scripts/game.cs");
  60. }
  61.  
  62.  
  63. //-----------------------------------------------------------------------------
  64.  
  65. function initDedicated()
  66. {
  67.    enableWinConsole(true);
  68.    echo("\n--------- Starting Dedicated Server ---------");
  69.  
  70.    // Make sure this variable reflects the correct state.
  71.    $Server::Dedicated = true;
  72.  
  73.    // The server isn't started unless a mission has been specified.
  74.    if ($missionArg !$= "") {
  75.       createServer("MultiPlayer", $missionArg);
  76.    }
  77.    else
  78.       echo("No mission specified (use -mission filename)");
  79. }
  80.  
  81.